﻿<%@ Page Title="用户主表维护" Language="C#" MasterPageFile="~/masterPage/admin/Manage.master"
    AutoEventWireup="true" CodeFile="ManageUser.aspx.cs" Inherits="ManageRoles" %>

<%@ MasterType VirtualPath="~/masterPage/admin/Manage.master" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">

    <div>
        <table cellspacing="0" cellpadding="4" class="Retrieval">
            <tr class="Retrieval_T">
                <td width="60" rowspan="2">
                    <font>显示<br />
                        条件</font>
                </td>
                <td width="70">
                    <font>是否锁定</font>
                </td>
                <td>
                    <font>用户名称</font>
                </td>
                <td>
                    <font>注册期间</font>
                </td>
                <td>
                    <font>最后登录期间</font>
                </td>
                <td width="80">
                    <font>条件设置</font>
                </td>
            </tr>
            <tr align="center" class="Retrieval_C">
                <td>
                    <asp:CheckBox ID="cbIsLockOut" runat="server" Text="被锁定" />
                </td>
                <td>
                    <asp:TextBox ID="tbUserName" CssClass="tb_RoleName" runat="server" MaxLength="20"></asp:TextBox>
                </td>
                <td>
                    <telerik:RadDatePicker ID="dpCreateStDay" runat="server">
                    </telerik:RadDatePicker>
                    <asp:Label ID="Label1" runat="server" Text="～"></asp:Label>
                    <telerik:RadDatePicker ID="dpCreateEdDay" runat="server">
                    </telerik:RadDatePicker>
                </td>
                <td>
                    <telerik:RadDatePicker ID="dpLastLoginStDay" runat="server">
                    </telerik:RadDatePicker>
                    <asp:Label ID="Label2" runat="server" Text="～"></asp:Label>
                    <telerik:RadDatePicker ID="dpLastLoginEdDay" runat="server">
                    </telerik:RadDatePicker>
                </td>
                <td>
                    <asp:Button ID="Btn_Set" CssClass="Btn_Set" runat="server" Text="索引" OnClick="Btn_Set_Click" />
                </td>
            </tr>
        </table>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
            <telerik:RadGrid runat="server" ID="gv_User" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" PageSize="20" GridLines="Both" Width="97%" ShowStatusBar="True"
                OnUpdateCommand="gv_User_UpdateCommand" OnInsertCommand="gv_User_InsertCommand"
                OnDeleteCommand="gv_User_DeleteCommand" OnItemCommand="gv_User_ItemCommand" CssClass="gv_User"
                CellSpacing="0" Culture="ja-JP" DataSourceID="sqlDSUser">
                <PagerStyle Mode="NumericPages" AlwaysVisible="true" />
                <MasterTableView Width="100%" CommandItemDisplay="Top" DataSourceID="sqlDSUser" DataKeyNames="UserId">
                    <NoRecordsTemplate>
                        没有任何用户的数据！</NoRecordsTemplate>
                    <CommandItemSettings AddNewRecordText="创建新角色" ShowRefreshButton="true" ShowAddNewRecordButton="false"
                        RefreshText="刷新数据"></CommandItemSettings>
                    <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="UserName" FilterControlAltText="Filter UserName column"
                            HeaderText="用户名" SortExpression="UserName" UniqueName="UserName" ReadOnly="True">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="CreateDate" DataType="System.DateTime" FilterControlAltText="Filter CreateDate column"
                            HeaderText="创建时间" SortExpression="CreateDate" UniqueName="CreateDate" ReadOnly="True">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="LastLoginDate" DataType="System.DateTime" FilterControlAltText="Filter LastLoginDate column"
                            HeaderText="上次登录时间" SortExpression="LastLoginDate" UniqueName="LastLoginDate"
                            ReadOnly="True">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn DataField="IsLockedOut" DataType="System.Boolean" FilterControlAltText="Filter IsLockedOut column"
                            HeaderText="是否被锁" SortExpression="IsLockedOut" UniqueName="IsLockedOut">
                            <ItemTemplate>
                                <asp:CheckBox ID="cbIsLockedOut" runat="server" Checked='<%# (bool)Eval("IsLockedOut") %>'>
                                </asp:CheckBox>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="LastLockoutDate" DataType="System.DateTime" FilterControlAltText="Filter LastLockoutDate column"
                            HeaderText="上回被锁时间" SortExpression="LastLockoutDate" UniqueName="LastLockoutDate"
                            ReadOnly="True">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn DataField="IsApproved" DataType="System.Boolean" FilterControlAltText="Filter FailedPasswordAttemptCount column"
                            HeaderText="IsApproved" SortExpression="IsApproved" UniqueName="IsApproved">
                            <ItemTemplate>
                                <asp:CheckBox ID="cbIsApproved" runat="server" Checked='<%# (bool)Eval("IsApproved") %>'>
                                </asp:CheckBox>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridButtonColumn ButtonType="LinkButton" CommandName="approve" Text="变更"
                            ConfirmDialogHeight="100" ConfirmDialogWidth="100" ConfirmTitle="确认变更" ConfirmText="确认您要变更该用户被锁定/被承认吗？"
                            ConfirmDialogType="Classic">
                        </telerik:GridButtonColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn ButtonType="ImageButton" CancelText="取消" InsertText="新建" />
                    </EditFormSettings>
                    <PagerStyle AlwaysVisible="False"></PagerStyle>
                </MasterTableView>
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
            </telerik:RadGrid>
        </telerik:RadAjaxPanel>
    </div>
    <asp:SqlDataSource ID="sqlDSUser" runat="server" ConnectionString="<%$ ConnectionStrings:XunPanConnectionString %>"
        SelectCommand="select m.UserId as UserId, u.UserName as UserName,m.CreateDate as CreateDate,m.LastLoginDate,m.IsLockedOut as IsLockedOut,
m.LastLockoutDate as LastLockoutDate,m.IsApproved as IsApproved
from aspnet_Membership m,aspnet_Users u where m.UserId = u.UserId and u.UserName like @userName and m.CreateDate&gt;=@createStDay and m.CreateDate&lt;=@createEdDay and m.LastLoginDate&gt;=@lastLoginStDay and m.LastLoginDate&lt;=@lastLoginEdDay and m.IsLockedOut = @isLocked">
        <SelectParameters>
            <asp:ControlParameter ControlID="tbUserName" DefaultValue="%" Name="UserName" PropertyName="Text" />
            <asp:Parameter DefaultValue="19000101" Name="createStDay" />
            <asp:Parameter DefaultValue="20991231" Name="createEdDay" />
            <asp:Parameter DefaultValue="19000101" Name="lastLoginStDay" />
            <asp:Parameter DefaultValue="20991231" Name="lastLoginEdDay" />
            <asp:Parameter DefaultValue="0" Name="isLocked" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
